home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_07_03 / v7n3046a.txt < prev    next >
Text File  |  1989-01-02  |  591b  |  29 lines

  1.  
  2.  
  3. main()
  4. {
  5.         int i = 10;
  6.         const ci = 20;
  7.         int *pi = &i;
  8.         const int *pci = &ci;
  9.         int * const cpi = &i;
  10.         const int * const cpci = &ci;
  11.  
  12.         pi = &i;        /* OK */
  13.         *pi = 20;       /* OK */
  14. /*1*/   pi = &ci;       /* error */
  15.  
  16.         pci = &ci;      /* OK */
  17.         *pci = 25;      /* error */
  18. /*2*/   pci = &i;       /* OK */
  19.         *pci = 25;      /* error */
  20.  
  21.         *cpi = 10;      /* OK */
  22.         cpi = &i;       /* error */
  23.  
  24.         *cpci = 10;     /* error */
  25.         cpci = &ci;     /* error */
  26. }
  27.  
  28.  
  29.